package org.jdcenter.server.deployment;

import java.lang.reflect.Method;

import net.sf.cglib.proxy.MethodProxy;

public abstract class AbstractInterceptor implements Interceptor{
	
	protected Interceptor interceptor = null;

	@Override
	public void intercept(Object obj, Method method, Object[] args,
			MethodProxy proxy) throws Throwable {
		doIt(obj,method,args,proxy);
		if(interceptor != null){
			interceptor.intercept(obj, method, args, proxy);
		}
	}
	
	
	protected abstract void doIt(Object obj1, Method method, Object[] args,
			MethodProxy proxy) throws Throwable;

	@Override
	public void setNext(Interceptor interceptor) {
		this.interceptor = interceptor;
	}

}
